package main

import (
	"flag"

	"gitee.com/thubcc/rtlmmap/web"
	"github.com/gin-gonic/gin"
)

var (
	argReset = flag.Bool("r", false, "Reset PPM")
)

func main() {
	flag.Parse()
	r := gin.Default()
	vs := web.NewViews(*argReset)
	r.GET("/list", vs.List)
	r.GET("/gettuner/:port", vs.PortSpecificationAPI("GetTuner"))
	r.GET("/settuner/:port", vs.PortSpecificationAPI("SetPPM"))
	r.GET("/spectrum/:port", vs.PortSpecificationAPI("Spectrum"))
	r.GET("/open/:port", vs.NewView)
	r.Run(":8081")
}
